<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>摊位经营用户信息管理</title>
<%@ include file="../au_inc.jsp"%>
<style type="text/css">
table.gridtable {
	font-family: verdana, arial, sans-serif;
	font-size: 11px;
	color: #333333;
	border-width: 1px;
	border-color: #666666;
	border-collapse: collapse;
}

table.gridtable th {
	border-width: 1px;
	padding: 1px;
	border-style: solid;
	border-color: #666666;
	background-color: #dedede;
}

table.gridtable td {
	border-width: 1px;
	padding: 1px;
	border-style: solid;
	border-color: #666666;
	background-color: #ffffff;
}

td input,td select{
	width:250px;
}
</style>
<script type="text/javascript">
	//所有的子窗体都需要有一个save函数，当点击弹出窗体的保存按钮时所进行的操作
	function btnSave_click() {
		var fun_ret = false;
		var vals = $('#formModule').serialize();
		var url = '${baseUrl}/admin/bussOperator/save';
		var valid = $('#formModule').form('validate');

		var head_img = $("#head_img")[0].files[0];
		console.log('head_img', head_img);
		//根据ID获得页面当中的form表单元素
		var form = document.querySelector("#formModule");
		//将获得的表单元素作为参数，对formData进行初始化
		var formdata = new FormData(form);
		//通过get方法获得name为advName元素的value值
		console.log(formdata.get("head_img"));//xixi
		//通过get方法获得name为advType元素的value值

		var checked = $('#head_img').val()
		var tip = ''
		var oldId = '${bussOperator.id}'
		if(!checked && !oldId){
			tip = '个人头像不能为空！'
		}
		if(tip){
			$.messager.alert('提示',tip,'error');
			return false;
		}
		
		if (true) {

			$.ajax({
				async : false,
				url : url,
				type : "post",
				data : formdata,
				cache : false,
				contentType : false,
				processData : false,
				dataType : 'json',
				success : function(data) {
					if (data.success != 0) {
						top.Ext.Msg.alert("提示", data.msg);
					} else {
						fun_ret = true;
					}
				}
			});

		}

		return fun_ret;
	}
</script>
</head>
<body>
	<div style="padding: 0px">
		<form id="formModule" method="post" enctype="multipart/form-data"
			autocomplete="off">
			<input id="id" type="hidden" name="bussOperator.id"
				value="${bussOperator.id }">
			<input id="oldHeadImg" type="hidden" name="bussOperator.head_img"
				value="${bussOperator.head_img }">
			<table cellpadding="0" border="0" width="100%" class="gridtable">
				<tr>
					<th>姓名：</th>
					<td><input id="user_name" class="easyui-validatebox textbox"
						type="text" name="bussOperator.name" data-options="required:true"
						value="${bussOperator.name }"></input></td>
					<th>登录账号：</th>
					<td><input id="user_name" class="easyui-validatebox textbox"
						type="text" name="bussOperator.account_name"
						<c:if test="${bussOperator.id > 0}">disabled</c:if>
						data-options="required:true,validType:['onlyNumChar','checkUnique[\'${baseUrl}/admin/users/checkUniqueLoginName\',\'loginName\',\'登陆名称已存在!\']']"   value="${bussOperator.account_name }"></input>
					</td>
				</tr>
				<tr>
					<th>年龄：</th>
					<td><input id="login_name" class="easyui-validatebox textbox"
						type="number" name="bussOperator.age" data-options="required:true,validType:'numBetween[18,70]'"
						value="${bussOperator.age }" invalidMessage="年龄范围为18~70岁"></input></td>
					<th>性别：</th>
					<td><select class="easyui-combobox" id="sex"
						name="bussOperator.sex" style="width: 250px;" data-options="width:'250px',height:'26xpx'">
							<option value="0">男</option>
							<option value="1">女</option>
					</select></td>
				</tr>
				<tr>
					<th>身份证号:</th>
					<td><input id="address" class="easyui-validatebox textbox"
						type="text" data-options="required:true,validType:'idcared'"
						name="bussOperator.card_no" value="${bussOperator.card_no }"></input></td>
					<th>联系地址:</th>
					<td><input id="address" class="easyui-validatebox textbox"
						type="text" name="bussOperator.address"
						value="${bussOperator.address }"></input></td>

				</tr>
				<tr>
					<th>联系电话:</th>
					<td><input id="phone" class="easyui-validatebox textbox"
						type="text" data-options="required:true,validType:'phoneNum'"
						missingMessage="联系电话不能空" invalidMessage="请输入正确的手机号码"
						name="bussOperator.phone" value="${bussOperator.phone }"></input></td>
					<th>EMail:</th>
					<td><input id="qq" class="easyui-validatebox textbox"
						type="text" validType='email' missingMessage="邮箱不能为空"
						invalidMessage="请输入正确的邮箱" data-options="required:true"
						name="bussOperator.email" value="${bussOperator.email }"></input></td>
				</tr>
				<tr>
					<th>个人头像:</th>
					<td><input type="file" id="head_img" class="textbox" style="width:250px;"
						name="head_img"></input></td>
					<th>现居住地址:</th>
					<td><input id="address" class="textbox" type="text"
						name="bussOperator.now_address"
						value="${bussOperator.now_address }"></input></td>
				</tr>
			</table>
		</form>
	</div>
</body>
<style>
	
</style>
</html>
